<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<?php include("includes/nav.php"); ?>		
<?php
	$xml=simplexml_load_file('includes/gallery.xml');
	
	$itemCount = 0;
	foreach($xml as $column){
		$itemCount += count($column->children());
	}
	if(isset($_GET['id']) && $_GET['id'] != "")  
		$currentId = $_GET['id'];
	else  
		$currentId = 1;
	if($currentId>$itemCount || $currentId < 1)
		$currentId = 1;
	
	$prevId = $currentId - 1;
	$nextId = $currentId + 1;
	
	if($nextId > $itemCount){
		$nextId = 1;
	}
	elseif($prevId < 1){
		$prevId = $itemCount;
	}
	
	$currentImageURL = "";
	$currentImageTitle = "";
	$currentImageYear = "";
	$currentImageDescrip = "";
	$counter = 0;
	foreach($xml as $column){
		foreach($column as $item){
			$counter++;
			if($currentId == $counter){
				$currentImageURL = $item->imagePath;
				$currentImageTitle = $item->title;
				$currentImageYear = $item->year;
				$currentImageDescrip = $item->descrip;
			}
		}
	}
?>
		
<head> 
	<title>Art - Pam Wishbow Illustration</title>
	<meta name="keywords" content="Illustration, Mid-Century, mid-century modern, cartoon modern, conceptual, conceptual illustration, poster design, poster illustration, illustrator, conceptual illustrator, design illustration, character animation, character designer, retro illustration, scad illustrator, scad, teatrio" /> 
	<meta name="description" content="" /> 	
	<?php include("includes/head.php"); ?>
</head>
<body> 
	<div id="wrapper">
		<div id="header">
			<a href="index.php" class="logo"><img src="images/wishbow-logo.gif" alt="Pam Wishbow's Logo" /></a>
			<ul class="contact">
				<li>illustrator</li>
				<li>732.259.3119</li>
				<li>pamwishbow@gmail.com</li>
			</ul>
			<?php DisplayNav("art"); ?>
		</div>
		<ul id="wishbow-sidebar">
			<li><a href="http://www.flickr.com/photos/pamwishbow/" target="_blank"><div class="flickr"></div></a></li>
			<li><a href="http://www.facebook.com/pamwishbowillustration" target="_blank"><div class="facebook"></div></a></li>
			<li><a href="http://twitter.com/#!/pamwishbow" target="_blank"><div class="twitter"></div></a></li>
			<li class="last"><a href="http://wishbow.tumblr.com/" target="_blank"><div class="tumblr"></div></a></li>
		</ul>
		<div id="content">
			<div class="controls">
				<a href='art.php?id=<?= $prevId ?>'><img src='images/grey-arrow-left.gif' alt='previous image'/></a>
				<a href='art.php?id=<?= $nextId ?>'><img src='images/grey-arrow-right.gif' alt='next image' /></a>
			</div>
			<div style="text-align:center; margin-bottom:30px; min-height:200px;">
				<a href="images/<?= $currentImageURL ?>" target="_blank">
					<img src='images/<?= $currentImageURL ?>' alt="" />
				</a>
				<p class="imageDescrip"><?= $currentImageTitle ?> - <?= $currentImageYear ?> - <?= $currentImageDescrip ?></p>
			</div>
			<div id="thumbContainer">
				<?php
				$itemCounter = 0;
				$colCounter = 0;
				foreach($xml as $column){
					$colCounter++;
					echo "<div class='col".$colCounter."'>";
					
					foreach($column as $item){
						$itemCounter++;
						echo "<a class='thumbLink' href='art.php?id=".$itemCounter."'><img src='images/".$item->thumbPath."' alt='Thumbnail ".$itemCounter."' /></a>\n";
					}
					
					echo "</div>";
				}
				?>
			</div>
			<div style="clear:both;" />
		</div>
	</div>
</body> 
</html> 